<template>
  <div>
    <el-dialog title="驳回" :visible.sync="editShow" width="600px" append-to-body :close-on-click-modal="false">
      <el-form ref="itemForm" :model="itemForm" :rules="deviceRules" label-width="120px">
        <el-form-item label="驳回原因" prop="reasonForRefusal">
          <el-input type="textarea" v-model="itemForm.reasonForRefusal" :autosize="{ minRows: 4 }" maxlength="255" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitItemForm">保 存</el-button>
        <el-button @click="deviceCancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
export default {
  data() {
    return {
      loading: false, // 加载中
      itemForm: {
        reasonForRefusal: ''
      },
      deviceRules: {
        reasonForRefusal: [
          { required: true, message: "驳回原因不能为空", trigger: "blur" },
        ],
      },
      editShow: false, // 检查项编辑弹窗
      dataList: [], //检查项页面详情列表
    };
  },
  methods: {
    // 取消检查项编辑
    deviceCancel() {
      this.editShow = false;
      this.resetForm("itemForm");
    },
    init() {
      this.editShow = true;
    },
    // 提交检查项表单
    submitItemForm() {
      this.$refs.itemForm.validate((valid) => {
        if (valid) {
          this.editShow = false
          this.$emit('clientSubReject', this.itemForm)
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped></style>
